package spec.ecore;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.emf.ecore.EParameter;
import org.eclipse.emf.ecore.impl.EOperationImpl;
import org.eclipse.emf.ecore.impl.EParameterImpl;

public class EcoreMethod {

	private String name;
	private String returnType;
	private ArrayList<String[]> param_list;

	public EcoreMethod(EOperationImpl eOperation) {
		name = eOperation.getName();
		param_list = new ArrayList<String[]>();

		for (EParameter next : eOperation.getEParameters()) {
			if (next instanceof EParameterImpl) {
				String name = ((EParameterImpl) next).getName();
				String type = ((EParameterImpl) next).getEType().getName();
				param_list.add(new String[] { name, type });
			}
		}
	}

	public String getName() {
		return name;
	}

	public String getReturnType() {
		return returnType;
	}

	public List<String[]> getParam_list() {
		return param_list;
	}

	public List<String> getParaname_list() {
		List<String> paralist = new ArrayList<String>();

		for (String[] attr : param_list) {
			paralist.add(attr[0]);
		}

		return paralist;

	}
}
